let PolygonPrimitive = (function () {
  function _(positions, layer, options) {
    this.layer = layer;
    this.entity = new Cesium.Entity({
      name: '多边形',
      polygon: {
        hierarchy: [],
        material: Cesium.Color.fromCssColorString(options.color),
        zIndex: options.zIndex || 0
      }
    });

    this.hierarchy = {positions};
    this._init();
  }

  _.prototype._init = function () {
    let _self = this;
    let _update = function () {
      return _self.hierarchy;
    };
    //实时更新polygon.hierarchy
    this.entity.polygon.hierarchy = new Cesium.CallbackProperty(_update, false);
    this.layer.entities.add(this.entity);
  };
  return _;
})();
export default PolygonPrimitive;